<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('人工智能图片识别历史列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>类型：</p>
                                <select name="aiType" th:with="type=${@dict.getType('ai_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" >
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "third/aiHis";
        $(function() {
            var options = {
                url: prefix + "/list",
                detailUrl: prefix + "/detail/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "人工智能图片识别历史",
                columns: [{
                    checkbox: true
                },
                {field : 'id',title : 'ID',visible: false},
                {field : 'yhid',title : '用户ID',visible: false},
                {field : 'yhmc',title : '用户名称',width:"125px"},
                {field : 'aiType',title : '类型',visible: false},
                {field : 'typeName',title : '类型',width:"145px"},
                {field : 'result',title : '结果',width:"125px",
                    formatter: function(value, row, index) {
                        if (value == 1) {
                            return '<span class="badge badge-primary">成功</span>';
                        } else if (value == 0) {
                            return '<span class="badge badge-danger">失败</span>';
                        }
                    }
                },
                {field : 'errorMsg',title : '错误信息',visible: false},
                {field : 'jsonResult',title : '请求结果',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {title: '操作', align: 'center',width:"145px", formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>